#!/usr/bin/python
# -*- coding: utf-8 -*-

import Ice, sys
import SnifferI
from SnifferI import *

class SnifferServer (Ice.Application):

    def run (self, argv):
        
        self.shutdownOnInterrupt()

        properties = self.communicator().getProperties()
        host = properties.getProperty('db_host')
        user = properties.getProperty('db_user')
        passwd = properties.getProperty('db_passwd')
        db = properties.getProperty('db_db')

        adapter = self.communicator().createObjectAdapter('SnifferAdapter')
        adapter.add(SnifferI(host, user, passwd, db),
                    self.communicator().stringToIdentity("sniffer"))
        adapter.activate()

        self.communicator().waitForShutdown()

        return 0

SnifferServer().main(sys.argv)
sys.exit(app.main(sys.argv))
